package com.dng.book.util;

import cn.hutool.crypto.digest.DigestUtil;

/**
 * 密码生成工具类
 * 用于生成正确的密码哈希值
 *
 * @author dng
 * @since 2024-01-01
 */
public class PasswordGenerator {

    public static void main(String[] args) {
        String password = "123456";
        String hashedPassword = DigestUtil.md5Hex(password);
        System.out.println("原始密码: " + password);
        System.out.println("加密后的密码: " + hashedPassword);
        
        // 验证密码
        boolean isValid = DigestUtil.md5Hex(password).equals(hashedPassword);
        System.out.println("密码验证结果: " + isValid);
        
        // 生成SQL更新语句
        System.out.println("\nSQL更新语句:");
        System.out.println("UPDATE T_USER SET PASSWORD = '" + hashedPassword + "' WHERE USERNAME = 'admin';");
    }
} 